
UPDATE  ${sourceTable} T
   SET T.RANK =
       (SELECT COUNT(*)
          FROM  ${sourceTable} O
         WHERE O.INDICATORTYPE_ID = T.INDICATORTYPE_ID
           AND O.NETWORKSERVING_ID = T.NETWORKSERVING_ID
              --
           <#list dimensionAttributeTypes as t>
           AND O.${t.columnName} = T.${t.columnName}
           </#list>
              --
           AND O.BATCHTIMESTAMP <= to_date('2014/5/25','yyyy/mm/dd') 
           AND T.VALUE >= O.VALUE) /
       (SELECT COUNT(*)
          FROM  ${sourceTable} O
         WHERE O.INDICATORTYPE_ID = T.INDICATORTYPE_ID
           AND O.NETWORKSERVING_ID = T.NETWORKSERVING_ID
              --
           <#list dimensionAttributeTypes as t>
           AND O.${t.columnName} = T.${t.columnName}
           </#list>
              --              
           AND O.BATCHTIMESTAMP <= to_date('2014/5/25','yyyy/mm/dd') )
 WHERE T.BATCHTIMESTAMP =to_date('2014/5/25','yyyy/mm/dd');